package com.gamejelly.broker;

import com.gamejelly.broker.client.BrokerClient;
import com.gamejelly.broker.client.BrokerClientImpl;

public class Main {

    public static final int PORT = 21312;
    public static final String BROKER_ADDR = "localhost:" + PORT;


    public static void main(String[] args) throws Exception {
//        BrokerServerImpl server = BrokerServer.builder()
//                .port(PORT)
//                .addMessageProcessor(new ServerRpcHandler())
//                .addMessageProcessor(new RegisterHandler())
//                .addConnEventProcessor(ConnectionEventType.CLOSE, new DisconnectHandler())
//                .Build();
        BrokerClientImpl game = BrokerClient.builder()
                .brokerAddr(BROKER_ADDR)
                .clientName("account")
                .Build();
        game.init();
//
//        BrokerClientImpl account = BrokerClient.builder()
//                .brokerAddr(BROKER_ADDR)
//                .clientName("account")
//                .Build();
//        account.addRpcHandler(response -> {
//            String s = new String(response.getData());
//            System.out.println("receive : " + s);
//            response.reply(s);
//        });
//        account.init();
//
        String result = game.request("Example", "findName", "game",null, String.class);

        System.out.println(result);

    }
}
